<template>
    <div class="home">
        <!-- 饿了么搜索框 -->
        <div class="search">
            <div class="title">饿了么</div>
            <div class="inputBox">
                <input type="text" placeholder="输入商家、商品名称">
            </div>
        </div>
        <!-- 轮播图 -->
        <div class="swiper">
            <img :src=pic alt="">
        </div>
        <div class="shoplist">
            <div @click="toDetail(item)" class="shop" v-for="(item,index) in shoplist" :key="index">
                <div class="imgbox">
                    <img :src="item.picUrl" alt="">
                </div>
                <div class="text">
                    <div class="name">{{item.name}}</div>
                    <div class="sale">☆{{item.wmPoiScore/10}}{{item.monthSalesTip}}</div>
                    <div class="desc">{{item.minPriceTip}}{{item.shippingFeeTip}}</div>
                </div>
            </div>
        </div>

    </div>
</template>

<script>
import { shop_list } from '../../utils/api'
export default {
    data() {
        return {
            pic: "https:img2.baidu.com/it/u=999150412,884289425&fm=253&fmt=auto&app=120&f=JPEG?w=640&h=320",
            currentIndex: 0,
            list: ['综合排序', '距离最近', '销量最高', '筛选'],
            goods: [],
            shoplist: [],
        }
       
    },
    mounted() {
        shop_list().then((res) => {
            this.shoplist = res.data.list
        })
    },
    methods: {
        toDetail(item) {
            this.$router.push('/detail/' + item.mtWmPoiId);
        }
    }
}
</script>

<style lang="scss" scoped>
.search {
    width: 100%;
    height: 100px;
    padding: 10px;
    box-sizing: border-box;
    background: rgba(1, 142, 255, 0.7);

    .title {
        margin: 10px 0;
        font-size: 24px;
        color: white;
        font-weight: bold;
    }

    ;

    input {
        width: 100%;
        height: 30px;
        border-radius: 20px;
        border: none;
        outline: none;
        text-align: center;
    }
}

// 轮播图
.swiper {
    height: 100px;
    margin: 10px;
    background: #f5f5f5;

    img {
        width: 100%;
        height: 100%;
        border-radius: 10px;
    }
}

.shoplist {
    margin: 10px;
    .shop {
        display: flex;
        margin: 10px 0;
        .imgbox {
            width: 80px;
            margin-right: 10px;

            img {
                width: 100%;
            }
        }
        .text {
            font-size: 12px;
        }
    }
}
</style>